# !/usr/bin python3
# encoding: utf-8 -*-
# @file     : market_service.py
# @author   : 沙陌 Matongxue_2
# @Time     : 2023/8/10 22:00
# @Copyright: 北京码同学
from dubbo.client import DubboClient
from dubbo.codec.encoder import Object

from common.dubbo_client import BaseDubbo


class MarketService(BaseDubbo):

    def __init__(self):
        super().__init__()
        self.service = DubboClient(
            interface='cn.testfan.dubbo.service.MarketService',
            host=self.host,
            dubbo_version=self.dubbo_version,
            version=self.version
        )

    # 抽奖接口
    def lottery(self,activity_id,user_id):
        res = self.send('lottery',activity_id,user_id)
        return res

    # 积分兑换接口
    def exchange(self,values):
        exchangeRequest = Object(
            'cn.testfan.dubbo.model.ExchangeRequest',
            values=values
        )
        res = self.send('exchange',exchangeRequest)
        return res
